import request from '@/utils/request'
/**
 * 获取商品详情
 * @param {*} id
 * @returns
 */
export const getGoodsDetailAPI = (id) => {
  return request({
    url: '/goods',
    params: { id }
  })
}

/**
 * 获取同类商品推荐
 * @param {*} id 商品id
 * @param {*} limit 数量
 * @returns
 */
export const getGoodsRelevantAPI = (id, limit = 16) => {
  return request({
    url: '/goods/relevant',
    params: { id, limit }
  })
}

/**
 * 获取热销商品
 * @param {*} id 商品id
 * @param {*} limit 数量
 * @param {*} type 类型
 * @returns
 */
export const getGoodsHotAPI = (id, limit = 4, type) => {
  return request({
    url: '/goods/relevant',
    params: { id, limit, type }
  })
}

/**
 * 获取商品的评价统计信息
 * @param {*} id 商品id
 * @returns
 */
export const getGoodsCommentAPI = (id) => {
  return request({
    url: `https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`
  })
}

/**
 * 获取商品的评价列表信息
 * @param {*} id 商品id
 * @param {*} params
 * @returns
 */
export const getGoodsCommentListAPI = (id, params) => {
  return request({
    url: `https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`,
    params
  })
}
